<include file="Public/min-header"/>
<div class="wrapper">
 <include file="Public/breadcrumb"/>
 <style>#search-form > .form-group{margin-left: 10px;}</style>
  <!-- Main content -->
  <section class="content">
    <div class="container-fluid">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title"><i class="fa fa-list"></i> 投诉列表</h3>
        </div>
        <div class="panel-body">
          <div class="navbar navbar-default">
              <form action="" id="search-form2" class="navbar-form form-inline" method="post" >
                <div class="form-group">
                  <select name="status_id" id="status_id" class="form-control">
                    <option value="">选择状态</option>
                      <option value="1" <if condition="$status_id eq 1">selected="selected"</if> >未处理</option>
                      <option value="2"  <if condition="$status_id eq 2">selected="selected"</if> >已处理</option>

                  </select>
                </div>

                <!--排序规则-->
                <button type="submit"   class="btn btn-primary"><i class="fa fa-search"></i> 筛选</button>
              </form>
          </div>
            <div class="box-body">
                <div class="row">
                    <div class="col-sm-12">
                        <table id="list-table" class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
                            <thead>
                            <tr role="row">
                                <th valign="middle">ID</th>
                                <th valign="middle">用户名</th>
                                <th valign="middle">电话</th>
                                <th valign="middle">提交时间</th>
                                <th valign="middle">状态</th>
                                <th valign="middle">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <foreach name="lists" item="vo" key="k" >
                                <tr role="row" align="center" class="{$vo.level}" id="{$vo.level}_{$vo.id}" <if condition="$vo[level] gt 1">style="display:none"</if>>
                                <td class="text-left">{$vo.id}</td>

                                <td class="text-left">{$vo.user_id|get_user_name}</td>
                                <td class="text-left">{$vo.user_id|get_user_mobile}</td>
                                <td class="text-left">{$vo.add_time|date='Y-m-d H:i',###}</td>
                                <td class="text-left">
                                    <if condition="$vo[status] eq 1" >已处理<else/><span style="color:red">待处理</span></if>
                                </td>
                                <td>

                                    <a  title="查看" class="btn btn-info" href="{:U('Complain/complain_info',array('id'=>$vo['id']))}"><i class="fa  fa-eye"></i></a>
                                    <a   title="删除" class="btn btn-danger" href="javascript:del_fun('{:U('Complain/complainDelete',array('id'=>$vo['id']))}');"><i class="fa fa-trash-o"></i></a>


                                </td>
                               <!-- <td>
                                    <span>{$vo.tel} </span>
                                </td>
                                <td>
                                </td>
                                <td>
                                    <php>if($vo[status]==1){</php>
                                    <a    class="btn btn-primary" href="{:U('Coach/cut_status',array('id'=>$vo['id'],'status'=>$vo['status']))}">禁用</a>
                                    <php>}else{</php>
                                    <a   class="btn  btn-danger" href="{:U('Coach/cut_status',array('id'=>$vo['id'],'status'=>$vo['status']))}">启用</a>
                                    <php>}</php>
                                </td>-->

                                </tr>
                            </foreach>
                            </tbody>
                        </table>
                        <div class="row">
                            <div class="col-sm-3 text-left"></div>
                            <div class="col-sm-9 text-right">{$page}</div>
                        </div>
                    </div>
                </div>

            </div><!-- /.box-body -->
          <!--<div id="ajax_return"> </div>-->
        </div>
      </div>
    </div>
    <!-- /.row -->
  </section>
  <!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script>
    $(document).ready(function(){
		// ajax 加载商品列表
        ajax_get_table('search-form2',1);

    });


    // ajax 抓取页面 form 为表单id  page 为当前第几页
    function ajax_get_table(form,page){
		cur_page = page; //当前页面 保存为全局变量
            $.ajax({
                type : "POST",
                url:"/index.php?m=Admin&c=goods&a=ajaxGoodsList&p="+page,//+tab,
                data : $('#'+form).serialize(),// 你的formid
                success: function(data){
                    $("#ajax_return").html('');
                    $("#ajax_return").append(data);
                }
            });
        }

        // 点击排序
        function sort(field)
        {
           $("input[name='orderby1']").val(field);
           var v = $("input[name='orderby2']").val() == 'desc' ? 'asc' : 'desc';
           $("input[name='orderby2']").val(v);
           ajax_get_table('search-form2',cur_page);
        }

        // 删除操作
        function del(id)
        {
            if(!confirm('确定要删除吗?'))
                return false;
		$.ajax({
			url:"/index.php?m=Admin&c=goods&a=delGoods&id="+id,
			success: function(v){
                                var v =  eval('('+v+')');
                                if(v.hasOwnProperty('status') && (v.status == 1))
                                        ajax_get_table('search-form2',cur_page);
                                else
                                        layer.msg(v.msg, {icon: 2,time: 1000}); //alert(v.msg);
			}
		});
               return false;
          }
</script>
</body>
</html>